[Main] Support device-init grouped linear module too with when not using TE opfuser - #6000
Open
zhongbozhu wants to merge 7 commits into
Open
[Main] Support device-init grouped linear module too with when not using TE opfuser#6000zhongbozhu wants to merge 7 commits into
zhongbozhu wants to merge 7 commits into
Conversation
yaox12
approved these changes
Jul 27, 2026
zhongbozhu
force-pushed
the
main_support_device_group_linear
branch
2 times, most recently
from
July 29, 2026 02:32
7294e71 to
1f4a49e
Compare
13 tasks
zhongbozhu
force-pushed
the
main_support_device_group_linear
branch
from
August 1, 2026 00:55
944cb4e to
a78c12b
Compare
zhongbozhu
marked this pull request as ready for review
August 1, 2026 09:12
Contributor
Author
|
/ok to test 1f647e6 |
zhongbozhu
commented
Aug 3, 2026
| ) | ||
|
|
||
| @staticmethod | ||
| def _apply_packed_bias(intermediate_parallel, packed_bias, tokens_per_expert, permuted_probs): |
Contributor
Author
There was a problem hiding this comment.
Note: only models with routed expert bias will use this
Contributor
Author
|
/ok to test d5c9aed |
zhongbozhu
force-pushed
the
main_support_device_group_linear
branch
from
August 5, 2026 07:10
57ff027 to
d6d76b2
Compare
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
zhongbozhu
force-pushed
the
main_support_device_group_linear
branch
from
August 5, 2026 18:40
d6d76b2 to
f921404
Compare
Contributor
Author
|
/ok to test f921404 |
YangFei1990
reviewed
Aug 5, 2026
YangFei1990
left a comment
Contributor
There was a problem hiding this comment.
Just for my understanding, mcore will pass moe_use_grouped_tensor / use_transformer_engine_op_fuser into TE, but it is TE's responsibility to pick the groupgemm backend, which is depending on hardware/dtype/envs, so it might not necessarily follow what exactly provided by mcore, is that right?
| # Some dispatchers have already padded each expert's token segment before the tokens | ||
| # reach this module: | ||
| # * router padding changes the routing map before dispatch; | ||
| # * HybridEP pads as part of its fused dispatch/permute operation; |
| # The token buffer may already contain per-expert padding when padding was performed | ||
| # before expert compute: | ||
| # * router padding modified the routing map before dispatch; | ||
| # * HybridEP fused padding into dispatch/permute; |
| assert torch.isfinite(hidden_states.grad).all() | ||
|
|
||
|
|
||
| class TestGroupedTensorDispatcherNumerics: |
Contributor
There was a problem hiding this comment.
Could we also add test cases for NCCL EP?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Proper single weight support, discrete weight is not affected. Adds many numerical unit tests running on GB200.
Unit testing:
Note: some tests can only run with TE updated (NVIDIA/TransformerEngine#3224), for CI image, it should just pass without causing errors.
E2E testing:
Model - Qwen3.5 VL SFT
Dispatcher - HybridEP
Experiements - bf16 cublas grouped gemm [single weight ON/OFF] vs. cuteDSL with TE op fuser mxfp8 [single weight ON/OFF] vs mxfp8 cublas grouped gemm [single weight ON/OFF]
Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.